home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / expect / CHANGES.2to3 < prev    next >
Text File  |  1993-03-09  |  2KB  |  59 lines

  1. If you used to use Expect version 2 (any version written before
  2. September '91) you will find that the current version of Expect (3)
  3. introduced minor but significant incompatibilities.
  4.  
  5. The HISTORY file describes these briefly.  They are described at
  6. length in the man page.
  7.  
  8. I'm sorry if you feel annoyed at the incompatibilities, but Expect has
  9. been out for a year and a half, Tcl even longer.  Both Tcl and Expect
  10. are using this as a last chance to make significant changes, so that
  11. we will not disturb even more users in the future.
  12.  
  13. There is no automated conversion procedure (although see note below)
  14. for Expect or even raw Tcl.  For now, I suggest that you not bother
  15. fixing things that already work - just keep the old Expect around.
  16. The binary isn't very big after all.  If you do write a translation
  17. script, let me know.  Thanks.
  18.  
  19. Of course, I felt obligated to convert the examples distributed with
  20. expect.  I did this by hand while writing the new version itself,
  21. partly as an aid but mostly to test lots of variations.  In 90% of the
  22. scripts, all I had to do was change:
  23.  
  24. (changes due to Tcl)
  25.     'index' to 'lindex'
  26.     'range' to 'lrange'
  27.     'length' to 'llength'
  28.     'print' to 'send_user' or 'puts' depending on how you use it
  29.     'function .... c' with '[join [function [split string ""]] ""]'
  30. (changes due to Expect)
  31.     'expect_match' to 'expect_out(buffer)'
  32.     'set match_max' to 'match_max' (perhaps with -d flag)
  33.     '*' to '-re .+'
  34.  
  35. If anyone wants to write a script to do this, note the pitfalls:
  36.  
  37. 1) functions and variables do not share the same namespace, so it is a
  38. inappropriate to just globally rename things.
  39.  
  40. A number of optimizations can be made:
  41.  
  42. 1) If you are doing multiple split/joins, you should probably cache the
  43. split string.
  44.  
  45. 2) Virtually all uses of scan are unnecessary now, due to exec's automatic
  46. stripping of terminating newlines, and expect's support of regexps.
  47.  
  48. 3) String manipulation can be reduced or avoided entirely if you use
  49. expect -re.
  50.  
  51. 4) exec is no longer necessary to retrieve environment variables, since
  52. they can now be retrieved from $env.
  53.  
  54. 5) If you have been really anal about testing for timeout and eof, you
  55. can dramatically reduce the size of your scripts by using expect_before
  56. and expect_after.  This is more efficient, as well, since those actions
  57. are only parsed once.
  58.  
  59.